Repository navigation
Conversation
Register tracing cleanup when an instance acquires its context so close and setup failure both release local recording and relay subscriptions. Keep independently owned recorders and caller-supplied Hub contexts active.
|
@SaKaNa-Y is attempting to deploy a commit to the NuxtLabs Team on Vercel. A member of the Team first needs to authorize it. |
|
👁️🗨️ Review this pull request with grouped, summarized diffs at: raw result💭 analyzed by {
"headSha": "8609c9c62bb4d07925350e135c87cf7179961fab",
"result": {
"overallSummary": "Fixes a tracing leak: closing (or failing to initialize) a devframe/hub instance left its local tracing subscription active on Node's diagnostics channel, so a replacement instance in the same process could keep recording events for the closed one. The fix tracks ownership of the tracing host per instance and disposes it (subscriptions, stream, timer, listeners) on close/init-failure, while preserving recorders owned by attached tools or caller-supplied Hub contexts.",
"groups": [
{
"key": "tracing-lifecycle-fix",
"label": "Tracing lifecycle fix",
"summary": "Tracks which tracing sources a devframe/hub instance owns and releases them (local subscription, stream, timer, listeners) on close or failed setup, while leaving caller-supplied Hub contexts and attached tools' own recorders untouched. `attach()`/`detach()` now tolerate reattachment and failing unsubscribe calls during teardown.",
"category": "core",
"filePaths": [
"packages/devframe/src/node/host-tracing.ts",
"packages/devframe/src/node/instance-shell.ts",
"packages/devframe/src/adapters/initiate.ts",
"packages/hub/src/node/initiate.ts"
],
"critical": true,
"fileNotes": [
{
"path": "packages/devframe/src/node/host-tracing.ts",
"text": "Core of the fix: `dispose()` stops local recording and unsubscribes all attached sources without stopping their recorders; `attach`/`detach` are hardened against reentrancy and throwing unsubscribers."
},
{
"path": "packages/devframe/src/node/instance-shell.ts",
"text": "New `ownTracing()` hook lets `initDevframe`/`initHub` register the tracing host they created so it's disposed on `close()` or if `init()` rejects."
}
]
},
{
"key": "tracing-tests",
"label": "Tracing lifecycle tests",
"summary": "Regression coverage for the new teardown behavior: reattachment during unsubscribe, instance close while a tool keeps its own recorder, failed setup, and caller-owned Hub contexts surviving close/failed setup.",
"category": "tests",
"filePaths": [
"packages/devframe/src/node/__tests__/host-tracing.test.ts",
"packages/hub/src/node/__tests__/tracing-lifecycle.test.ts"
],
"fileNotes": [
{
"path": "packages/hub/src/node/__tests__/tracing-lifecycle.test.ts",
"text": "New end-to-end test file exercising both `initDevframe` and `initHub` entry points plus the borrowed-context case."
}
]
},
{
"key": "api-snapshot",
"label": "API snapshot update",
"summary": "Generated type snapshot updated to reflect the new `ownTracing` method on `InstanceShellApi`.",
"category": "other",
"filePaths": [
"tests/__snapshots__/tsnapi/devframe/internal.snapshot.d.ts"
],
"fileNotes": [
{
"path": "tests/__snapshots__/tsnapi/devframe/internal.snapshot.d.ts",
"text": "Auto-generated from the public type surface; no manual review needed beyond confirming it matches `instance-shell.ts`."
}
]
}
],
"schemaVersion": 1,
"source": "llm",
"generatedAt": "2026-11-21T08:25:59.775Z",
"model": "vercel-ai-gateway/anthropic/claude-sonnet-5",
"locale": "en"
}
} |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Closing a devframe or hub while its local recorder was active left that recorder subscribed to Node's diagnostics channel. If a replacement recorded the same channel in the same process, both instances captured the next call. Setup could leave the same subscription behind if it started recording and then threw.
initDevframe()andinitHub()now register tracing cleanup when they create a context, before setup runs.Evidence
Before: The reproduction closed one instance, started its replacement, and traced a call that returned
123. Both recorders captured that call. Stopping the replacement still left a subscriber on the channel.After: In the same reproduction, only the replacement captured
123. For both entry points, the setup-failure tests also confirmed that the original error reached the caller and the local subscription was gone.Merge Danger
Door: Two-way. Reverting restores the previous cleanup behavior.
Blast Radius: Tracing. Stopping an external recorder would make its owner miss later calls. The close tests confirm that an attached tool and a caller with a shared hub context can each record another call.